import graphene
import time
import datetime

class Query(graphene.ObjectType):
    hello = graphene.String(description='A typical hello world')
    goodbye = graphene.String()

    def resolve_hello(self, info):
        return f'Hello!{time.time()}'

    def resolve_goodbye(root, info):
        return 'See ya!'

class Query2(graphene.ObjectType):
    one_week_from = graphene.Date(required=True, date_input=graphene.Date(required=True))

    def resolve_one_week_from(root, info, date_input):
        assert date_input == datetime.date(2006, 1, 2)
        return date_input + datetime.timedelta(weeks=1)

if __name__ == '__main__':
    # print('sdfs')
    # schema = graphene.Schema(query=Query)
    # query = '''
    #     query SayHello{
    #         hello
    #     }
    # '''
    # result = schema.execute(query)
    # print(result.data['hello'])
    # query_string = '{hello(name:"GraphQL")}'
    # result = schema.execute(query_string)
    # print(result.data['hello'])

    schema2 = graphene.Schema(query=Query2)
    results = schema2.execute("""
        query {
            oneWeekFrom(dateInput: "2006-01-02")
        }
    """)
    assert results.data == {"oneWeekFrom": "2006-01-09"}
    a = "454"